package com.team.ai.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.stp.StpUtil;
import com.team.ai.entity.ResultEntity;
import com.team.ai.entity.User;
import com.team.ai.service.AiListService;
import com.team.ai.service.util.Result;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;

@CrossOrigin//跨域
@RestController//遵循RestFul
@RequestMapping("v2/AiList/")
public class AiListController {
    private static final Logger logger = LoggerFactory.getLogger(BookController.class);//日志getLogger需要传入的类名

   @Resource
//    @Autowired
    AiListService aiListService;
    @SaCheckLogin
    @GetMapping("selectList")
    public String selectList(){


        int userId = StpUtil.getLoginIdAsInt();

        if (Objects.isNull(userId)){
            return ResultEntity.fail(500);
        }
        return aiListService.selectList(userId) ;
    }
}
